using System;
using ViScript.Core.Argument;
using ViScript.Core.Utils;

namespace ViScript.Core.ParameterRules
{
    public class StringParameterRule : IParameterRule
    {
        public IArgument Parse(Type type, IText text, ISentence sentence)
        {
            if (text.IsEscaped)
            {
                return new NormalArgument(text.ToString());
            }
            if (sentence.ContainsSeparator(text.ToString()))
            {
                return UnrecognizedArgument.UNRECOGNIZED_ARGUMENT;
            }
            return new NormalArgument(text.ToString());
        }
    }
}